// 封装购物车模块
import request from '@/utils/request'

// 购物车
// 加入-购物车商品
export const addCartService = ({ skuId, count }) => request.post('/member/cart', { skuId, count })
// 获取-购物车列表
export const getCartListService = () => request.get('/member/cart')
// 删除-购物车商品
export const deleteCartService = (ids) => {
  return request.delete('/member/cart', {
    data: {
      ids,
    },
  })
}
// export const deleteCartService = (ids) => {
//   return request({
//     url: '/member/cart',
//     method: 'DELETE',
//     data: {
//       ids,
//     },
//   })
// }
// 合并-购物车商品
export const mergeCartService = (data) => request.post('/member/cart/merge', data)
// 修改-购物车商品
export const updateCartService = (id) => request.put(`/member/cart/${id}`)
// 修改-购物车全选/取消
export const updateCartAllService = ({ selected, ids }) =>
  request.put('/member/cart/selected', { selected, ids })
